using UnityEngine;
using System.Collections;

[System.Serializable]
public class SafeZone : MonoBehaviour {
	
	public string playerTag = "Player";
	public NavPoint monsterWaitPoint;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void OnTriggerEnter(Collider collision) {
		if (collision.tag == playerTag) {
			Debug.Log("Player is safe");
			Game.game.isPlayerInsideSafePlace = true;
			Game.game.moveStalkingMonsterToThisWhenPLayerIsSafe = monsterWaitPoint;
        }
	}
	
	void OnTriggerStay(Collider collision) {
		if (collision.tag == playerTag) {
			Game.game.isPlayerInsideSafePlace = true;
			Game.game.moveStalkingMonsterToThisWhenPLayerIsSafe = monsterWaitPoint;
        }
	}
	
	void OnTriggerExit(Collider collision) {
		if (collision.tag == playerTag) {
			Game.game.isPlayerInsideSafePlace = false;
			Debug.Log("Player is NOT safe");
        }
	}
	
	void OnDrawGizmos() {
		if (monsterWaitPoint != null) {
			Gizmos.color = new Color(1.0f, 0.5f, 0.0f, 1.0f);
			Gizmos.DrawLine(transform.position, monsterWaitPoint.transform.position);	
		}
	}
}
